<template>
  <div class="list">
    <div class="fenlei">
      <div class="fenleiText">
        <span>{{ fenleiTitle }}</span>
      </div>
    </div>
    <div class="content">
      <div class="list">
        <div
          class="listItem"
          v-for="(item, index) in curriculum"
          :key="index"
          @click="goDetail(item)"
        >
          <div class="image">
            <img :src="item.image" width="100%" height="100%" alt="" />
          </div>
          <div class="title">
            <span>{{ item.title }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex";

export default {
  computed: {
    ...mapState(["curriculum", "fenleiTitle"]),
  },
  data() {
    return {
      key: value,
    };
  },
  methods: {
    goDetail(e) {
      this.$store.dispatch("Details", e);
      this.$router.push({ path: "/details" });
    },
  },
};
</script>

<style lang="scss" scoped>
.list {
  width: 100%;
  min-height: 100vh;
  .fenlei {
    width: 100%;
    height: 200px;
    background-image: url("../../assets/bj.png");
    background-size: 100% 100%;
    .fenleiText {
      width: 1100px;
      height: 100%;
      margin: 0 auto;
      position: relative;
      span {
        color: #fff;
        font-family: "黑体";
        font-weight: 700;
        font-size: 40px;
        position: absolute;
        top: 50%;
        left: 0px;
      }
    }
  }
  .content {
    width: 1100px;
    min-height: 500px;
    margin: 0 auto;
    margin-top: 5px;
    background: #fff;
    padding: 20px;
    box-sizing: border-box;
    .list {
      width: 100%;
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      .listItem {
        cursor: pointer;
        padding: 20px;
        box-sizing: border-box;
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        border-radius: 10px;
        &:hover {
          box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.2);
        }
        .image {
          width: 100%;
          height: 80%;
        }
        .title {
          height: 20%;
          display: flex;
          align-items: center;
          justify-content: center;
          font-size: 16px;
          font-family: "楷体";
          font-weight: 600;
        }
      }
    }
  }
}
</style>
